Date.prototype.format = function (format) {
  var date = {
    'M+': this.getMonth() + 1,
    'd+': this.getDate(),
    'h+': this.getHours(),
    'm+': this.getMinutes(),
    's+': this.getSeconds(),
    'q+': Math.floor((this.getMonth() + 3) / 3),
    'S+': this.getMilliseconds()
  }
  if (/(y+)/i.test(format)) {
    format = format.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
  }
  for (var k in date) {
    if (new RegExp('(' + k + ')').test(format)) {
      format = format.replace(RegExp.$1, RegExp.$1.length == 1 ?
        date[k] : ('00' + date[k]).substr(('' + date[k]).length))
    }
  }
  var arrFormat = format.split(' ')
  return arrFormat
}
window.DP = {
  dateTime: function (stamp) {
    if (window.sub_int) {
      clearInterval(sub_int)
    }
    // 显示的事件按照每分钟自加
    function refreshDate() {
      var date = new Date();
      var year = date.getFullYear();
      var month = date.getMonth() + 1;
      var day = date.getDate();
      var firstDate = year + "\u5E74" + month + "\u6708" + day + "\u65E5";
      var secendtDate = (new Date().format('yyyy.MM.dd hh:mm'))[1];
      $('.date').text(firstDate);
      $('.time').text(secendtDate);
    }

    refreshDate()
    window.sub_int = setInterval(function () {
      refreshDate()
    }, 60000)
  },
  getUrlSearch: function () {
    var url = decodeURI(location.search); // 获取url中"?"符后的字串 ('?modFlag=business&role=1')             
    var theRequest = {}
    if (url.indexOf('?') != -1) {
      var str = url.substr(1); // substr()方法返回从参数值开始到结束的字符串；  
      var strs = str.split('&')
      for (var i = 0; i < strs.length; i++) {
        theRequest[strs[i].split('=')[0]] = (strs[i].split('=')[1])
      }
      return theRequest; // 此时的theRequest就是我们需要的参数；
    } else {
      return null
    }
  }
}

var pageInit = function () {
  // 时间
  DP.dateTime()
  // 大屏标题
  // $(".ping-title").text(config.PRO_TITLE.split("|").join(" / "))
}
